home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / GFXFX2.ZIP / SCR_HRES.PAS < prev    next >
Pascal/Delphi Source File  |  1995-02-14  |  2KB  |  53 lines

  1.  
  2. program highres_scroll; { SCR_HRES.PAS }
  3. { High-Resolution (mode 10h) hardware scroll, by Bas van Gaalen }
  4. uses dos,u_vga,u_mdx,u_kb;
  5. const noflines=70; thi=16; scrw=80; maxlines=350;
  6. type str80=string[80];
  7. var txt:array[0..noflines-1] of str80;
  8.  
  9. procedure readfile(fname:pathstr);
  10. var tfile:text; tstr:str80; i:byte; err:boolean;
  11. begin
  12.   err:=false;
  13.   fillchar(txt,sizeof(txt),0);
  14.   if fname='' then err:=true
  15.   else begin
  16.     assign(tfile,fname);
  17.     {$i-} reset(tfile); {$i+}
  18.     if ioresult<>0 then err:=true
  19.     else begin
  20.       i:=0;
  21.       while (i<noflines) and (not eof(tfile)) do begin
  22.         readln(tfile,tstr); txt[i]:=tstr; inc(i); end;
  23.       close(tfile);
  24.     end;
  25.   end;
  26.   if err then begin
  27.     writeln('Enter filename of textfile on commandline.'); halt; end;
  28. end;
  29.  
  30. var tbuf:array[0..thi-1,0..79] of byte; cline:integer; x,y,tline,tidx:byte;
  31. begin
  32.   readfile(paramstr(1));
  33.   setvideo($10); { init mode 10h (16d: 640x350x16) }
  34.   getfont(font8x16);
  35.   cline:=1; tline:=0; tidx:=0;
  36.   repeat
  37.     inc(cline);
  38.     mdx_setaddress(cline*scrw);
  39.     vretrace; vretrace;
  40.     move(tbuf[tline,0],mem[u_vidseg:cline*scrw-scrw],80);
  41.     move(tbuf[tline,0],mem[u_vidseg:cline*scrw+maxlines*scrw],80);
  42.     inc(tline);
  43.     if tline=thi then begin
  44.       tline:=0;
  45.       for y:=0 to 15 do for x:=0 to 79 do
  46.         tbuf[y,x]:=mem[seg(font^):ofs(font^)+ord(txt[tidx][x+1])*thi+y];
  47.       tidx:=(tidx+1) mod noflines;
  48.     end;
  49.     if cline>=maxlines then cline:=-1;
  50.   until keypressed;
  51.   setvideo(u_lm);
  52. end.
  53.